//
//  GoodChannelTableVC.m
//  LoveTrail
//
//  Created by giantumbrella on 15/6/12.
//  Copyright (c) 2015年 赵娟. All rights reserved.
//

#import "GoodChannelTableVC.h"
#import "CommonMacro.h"

#import "ScrollViewView.h"
#import "GoodChannelCell.h"
@interface GoodChannelTableVC ()
{
    NSMutableArray *pictureArr,*titleArr,*detailArr;
}
@property (nonatomic,strong) ScrollViewView *scrollViewView;
@end

@implementation GoodChannelTableVC

- (void)viewDidLoad {
    [super viewDidLoad];
    pictureArr = [NSMutableArray new];
    titleArr = [NSMutableArray new];
    detailArr = [NSMutableArray new];
    //创建导航栏头部 其他视图
    [self createNavigationBarAndOther];
    
    detailArr = [@[@"sd",@"f",@"f",@"w",@"w"] mutableCopy];
}

#pragma mark 创建导航栏头部 其他视图
- (void)createNavigationBarAndOther
{
    //设置导航栏背景颜色
    [self.navigationController.navigationBar setBarTintColor:UIColorWithRGBA(233, 56, 103, 1)];
    //设置导航栏字体颜色
    [self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName, nil]];
    
    self.title = @"优生优育资讯频道";
    self.tableView.showsVerticalScrollIndicator = NO;
    self.view.backgroundColor = UIColorWithRGBA(241, 241, 241, 1);
    
    //左侧返回按钮
    UIBarButtonItem *leftButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"_0001_购物车"] style:UIBarButtonItemStyleDone target:self action:@selector(backClick)];
    self.navigationItem.leftBarButtonItem = leftButton;
    self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

    return detailArr.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    static NSString *ID = @"Cell";
    GoodChannelCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[GoodChannelCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
    }
    cell.accessoryType = UITableViewCellAccessoryNone;
    cell.backgroundColor = UIColorWithRGBA(241, 241, 241, 1);
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 130;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 135;
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 135)];
//    view.backgroundColor = [UIColor redColor];
    //1.头部滚动视图
    self.scrollViewView = [[ScrollViewView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT*0.23)];
    [view addSubview:self.scrollViewView];

    return view;
}
#pragma mark 返回上一个界面
- (void)backClick
{
    [self dismissViewControllerAnimated:YES completion:nil];
}

@end
